#pragma once
#include "UIlib.h"
#include "utility.h"
#include <vector>


class CUserDlg :
	public WindowImplBase,
	public IListCallbackUI
{
public:
	CUserDlg();
	virtual ~CUserDlg();

	LPCTSTR GetWindowClassName() const { return _T("CUserDlg"); }
	virtual CDuiString GetSkinFile() { return _T("user.xml"); }
	virtual CDuiString GetSkinFolder() { return  _T("skin"); }
	//virtual UILIB_RESOURCETYPE GetResourceType() const { return UILIB_ZIPRESOURCE; }
	virtual void InitWindow();
	virtual LRESULT HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
private:
	virtual LPCTSTR GetItemText(CControlUI* pList, int iItem, int iSubItem);
	virtual LRESULT OnNcActivate(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled);

	LRESULT OnNewUser(WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnAlterUser(WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnAlterAuthority(WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnAlterPassword(WPARAM wParam, LPARAM lParam, BOOL& bHandled);

	DUI_DECLARE_MESSAGE_MAP()
	void OnBtnNewClick(TNotifyUI& msg);
	void OnBtnAlterClick(TNotifyUI& msg);
	void OnBtnDeleteClick(TNotifyUI& msg);
	void OnBtnUserRightClick(TNotifyUI& msg);
	void OnBtnAlterPasswordClick(TNotifyUI& msg);
	void OnUserListItemSelected(TNotifyUI& msg);
public:
	CLabelUI*				m_pLabTitle = nullptr;
	CButtonUI*				m_pUserRightBtn;
	CButtonUI*				m_pDeleteBtn;
	CListUI*				m_pUserList;
	std::vector<stUser*>	m_UserVec;
};

